home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWString / Include / FWPStr.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  26.7 KB  |  781 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPStr.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPSTR_H
  11. #define FWPSTR_H
  12.  
  13. #ifndef FWEXCLIB_H
  14. #include "FWExcLib.h"
  15. #endif
  16.  
  17. #ifndef FWARDYNA_H
  18. #include "FWArDyna.h"
  19. #endif
  20.  
  21. #ifndef SLTXTPAR_H
  22. #include "SLTxtPar.h"
  23. #endif
  24.  
  25. #ifndef SLSTRREP_H
  26. #include "SLStrRep.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward declarations
  31. //========================================================================================
  32.  
  33. struct ODIText;
  34. class FW_CReadableStream;
  35. class FW_CWritableStream;
  36. class FW_CString;
  37.  
  38. //========================================================================================
  39. //    CLASS FW_CString
  40. //
  41. //    Characters in strings may occupy one, two, and possibly more bytes.
  42. //  The number of characters in the string is therefore not necessarily equal 
  43. //    to the number of bytes in the string.
  44. //
  45. //    The "length" of the string is measured in characters.
  46. //  The "byteLength" of the string is measured in bytes.
  47. //  The "capacity" of the string is measure in bytes.
  48. //
  49. //========================================================================================
  50.  
  51. class FW_CString
  52. {
  53. public:
  54.     FW_DECLARE_CLASS
  55.     FW_DECLARE_AUTO(FW_CString)
  56.     
  57. //----------------------------------------------------------------------------------------
  58. //    Initialization/Destruction
  59. //
  60. public:
  61.     virtual ~FW_CString();
  62.     FW_CString();
  63.     FW_CString(const FW_CString& other);
  64.     FW_CString(FW_HString rep);
  65.  
  66.     FW_CString(ODIText *text);
  67.     FW_CString(const char* text);
  68.     FW_CString(const char* text, FW_ByteCount byteLength);
  69.  
  70.     FW_CString(const char* text, const FW_Locale& locale);
  71.     FW_CString(const char* text, FW_ByteCount byteLength, const FW_Locale& locale);
  72.     
  73.     operator FW_HString() const { return fRep; }
  74.     operator FW_HString*();
  75.  
  76. //----------------------------------------------------------------------------------------
  77. //    Character access
  78. //
  79. public:
  80.     FW_LChar operator[](FW_CharacterPosition position) const;
  81.         // This function may be expensive for some character sets!
  82.         // Note that it returns a "long character", which may be 1, 2, or possibly more bytes
  83.  
  84. //----------------------------------------------------------------------------------------
  85. //    Assignment
  86. //
  87. public:
  88.     void  operator=(const FW_CString& other);
  89.     void  operator=(ODIText *text);
  90.     void  operator=(const char* text);
  91.     
  92. //----------------------------------------------------------------------------------------
  93. //    Storage Manipulation
  94. //
  95. public:
  96.     FW_ByteCount GrowCapacity(FW_ByteCount count);
  97.         // If possible, grow the capacity to count bytes.
  98.         // Return the actual capacity, which may be less or more than count.
  99.     
  100. //----------------------------------------------------------------------------------------
  101. //    Basic accessors
  102. //
  103. public:
  104.     FW_ByteCount GetByteLength() const;
  105.         // Return the number of bytes actually in use for the string
  106.  
  107.     FW_CharacterCount GetCharacterLength() const;
  108.         // Return the number of characters actually in use for the string.
  109.         // Note that with some character sets this may be significantly more expensive
  110.         // to call than GetByteLength!
  111.  
  112.     FW_ByteCount GetCapacity() const;
  113.         // Return the number of bytes that may currently be used without growing capacity.
  114.         // Note that GrowCapacity can be used to extend the capacity beyond the current limit.
  115.     
  116.     void GetLocale(FW_Locale& locale) const;
  117.     
  118.     FW_Boolean IsEmpty() const;
  119.         // Returns true if the string is the empty string, i.e. it's bytelength is 0.
  120.     
  121. //----------------------------------------------------------------------------------------
  122. //    Access to internals, use with caution!
  123. //
  124. public:
  125.     const char* RevealBuffer() const;
  126.         // This function is provided for convenience but is potentially dangerous!!
  127.         // Do not cast away const and then modify the string!
  128.         // Do not save the return value and expect it to be valid after calling
  129.         // any string manipulation method that modifies the string!
  130.         // NOTE: This is not a NUL-terminated string! Use GetByteLength to determine
  131.         // how many bytes may be accessed.
  132.  
  133.     ODIText* RevealODIText() const;
  134.         // This function is provided for convenience but is potentially dangerous!!
  135.         // RevealODIText may be used when passing a String to an OpenDoc interface
  136.         // that takes an ODIText* as an "in" parameter.  Do not use this function to
  137.         // receive a string from OpenDoc!  Also, do not save the return value!
  138.         // Any string manipulation method that modifies the string may invalidate
  139.         // ODIText.
  140.     
  141. //----------------------------------------------------------------------------------------
  142. // Streaming
  143. public:
  144.  
  145.     static void* Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  146.  
  147.     static void Write(FW_CWritableStream& stream, FW_ClassTypeConstant type, const void *object);
  148.  
  149.     FW_CReadableStream& PrivRead(FW_CReadableStream& stream);
  150.  
  151.     FW_CWritableStream& PrivWrite(FW_CWritableStream& stream) const;
  152.  
  153.     friend inline FW_CReadableStream& operator>>(FW_CReadableStream& stream, FW_CString& string);
  154.     friend inline FW_CWritableStream& operator<<(FW_CWritableStream& stream, const FW_CString& string);
  155.  
  156. //----------------------------------------------------------------------------------------
  157. //    String Manipulation
  158. //
  159. public:
  160.     void Retrieve(char* destination, 
  161.                   FW_ByteCount numberBytes, 
  162.                   FW_BytePosition position) const;
  163.         // Retrieve numberBytes of bytes starting at position.
  164.         // Copy bytes into the destination.
  165.         
  166.     void Delete(FW_ByteCount numberBytes, 
  167.                 FW_BytePosition position);
  168.         // Delete numberBytes bytes, starting at position.
  169.         
  170.     void Insert(const char* bytes, 
  171.                 FW_ByteCount numberBytes,  
  172.                 FW_BytePosition position);
  173.         // Insert bytes into string just before the character at positition.
  174.         // Insert at position GetByteLength() appends the bytes.
  175.         // Insert at position 0 prepends the bytes.
  176.     
  177.     void Insert(ODIText* text, FW_BytePosition position);
  178.         // Insert text at position.
  179.     
  180.     void Insert(const FW_CString &string, FW_BytePosition position);
  181.         // Insert string at position.
  182.     
  183.     void ReplaceAll(ODIText* text);
  184.         // Replace entire contents of this string with text.
  185.     
  186.     void ReplaceAll(const FW_CString &string);
  187.         // Replace entire contents of this string with string.
  188.     
  189.     void ReplaceAll(const char* bytes, FW_ByteCount numberBytes);
  190.         // Replace entire contents of this string with bytes.
  191.  
  192.     void ReplaceAll(const char* string);
  193.         // Replace entire contents of this string with (nul-terminated) string.
  194.     
  195.     void ReplaceAll(const FW_PascalChar* string);
  196.         // Replace entire contents of this string with pascal string.
  197.  
  198.     void Append(const FW_CString &string);
  199.         // Append string onto end of this string.
  200.     
  201.     void Append(ODIText* text);
  202.         // Append text onto end of this string.
  203.     
  204.     void Append(const char* bytes, FW_ByteCount numberBytes);
  205.         // Append bytes onto end of this string.
  206.     
  207.     void Append(const char* string);
  208.         // Append (nul-terminated) string onto end of this string.
  209.     
  210.     void Append(char character);
  211.         // Append a single character onto the end of this string.
  212.         
  213.     void Prepend(const FW_CString &string);
  214.         // Prepend string onto beginning of this string.
  215.     
  216.     void Prepend(ODIText* text);
  217.         // Prepend text onto beginning of this string.
  218.     
  219.     void Prepend(const char* bytes, FW_ByteCount numberBytes);
  220.         // Prepend bytes onto beginning of this string.
  221.         
  222.     void Prepend(const char* string);
  223.         // Prepend (nul-terminated) string onto beginning of this string.
  224.         
  225.     void Truncate(FW_BytePosition position);
  226.         // Truncate string at position.  Truncate(0) clears string.
  227.         
  228.     void operator+=(const FW_CString &string);
  229.         // Append string onto the end of this string.
  230.         
  231.     void operator+=(ODIText* text);
  232.         // Append string onto the end of this string.
  233.         
  234.     void operator+=(const char* string);
  235.         // Append (nul-terminated) string onto the end of this string.
  236.         
  237.     void operator+=(char character);
  238.         // Append a single character onto the end of this string.
  239.     
  240. //----------------------------------------------------------------------------------------
  241. //    Exporting Functions
  242. //
  243. public:
  244.     void ExportCString(char* buffer) const;
  245.         // Copy contents of this string to external C string buffer.
  246.         // buffer will contain NUL-terminated C string.
  247.         // It is client's responsibility to ensure buffer is large enough.
  248.  
  249.     void ExportPascal(FW_PascalChar* buffer) const;
  250.         // Copy contents of this string to external 'Pascal' buffer.
  251.         // buffer will contain Pascal string with length byte at buffer[0].
  252.         // It is client's responsibility to ensure buffer is large enough.
  253.  
  254. //----------------------------------------------------------------------------------------
  255. //    Numeric Conversion Functions
  256. //
  257. public:
  258.     long            ParseAsSignedInteger() const;
  259.     unsigned long    ParseAsUnsignedInteger() const;
  260.     unsigned long    ParseAsHexadecimalInteger() const;
  261.     double            ParseAsRealNumber() const;
  262.     
  263.     void            ReplaceAllAsSignedDecimalInteger(long integer);
  264.     void            ReplaceAllAsUnsignedDecimalInteger(unsigned long integer);
  265.     void            ReplaceAllAsHexadecimalInteger(unsigned long integer);
  266.     void            ReplaceAllAsRealNumber(double real, short fracDigits = 2);
  267.     
  268. //----------------------------------------------------------------------------------------
  269. //    Comparison Functions
  270. //
  271. public:
  272.     friend FW_Boolean operator==(const FW_CString &string1, const FW_CString &string2);
  273.     friend FW_Boolean operator!=(const FW_CString &string1, const FW_CString &string2);
  274.     friend FW_Boolean operator<(const FW_CString &string1, const FW_CString &string2);
  275.     friend FW_Boolean operator>(const FW_CString &string1, const FW_CString &string2);
  276.     friend FW_Boolean operator<=(const FW_CString &string1, const FW_CString &string2);
  277.     friend FW_Boolean operator>=(const FW_CString &string1, const FW_CString &string2);
  278.  
  279. //----------------------------------------------------------------------------------------
  280. //    Searching & Substitution Functions
  281. //
  282. public:
  283.  
  284.     void ToUpper();
  285.     void ToLower();
  286.  
  287.     FW_Boolean Substitute(const FW_CString &searchString,
  288.                           const FW_CString &substitutionString);
  289.     
  290.     FW_Boolean FindSubString(const FW_CString &subString,
  291.                              FW_BytePosition &foundPosition,
  292.                              FW_BytePosition startPosition=0) const;
  293.     
  294.     FW_Boolean FindCharacter(FW_LChar character,
  295.                              FW_BytePosition &foundPosition,
  296.                              FW_BytePosition startPosition=0,
  297.                              FW_FindDirection direction=FW_kForwards) const;
  298.     
  299. protected:
  300.     FW_HString    fRep;
  301. };
  302.  
  303. //----------------------------------------------------------------------------------------
  304. // Inline functions
  305. //----------------------------------------------------------------------------------------
  306.  
  307. inline FW_CReadableStream& operator>>(FW_CReadableStream& stream, FW_CString& string)
  308. {
  309.     return string.PrivRead(stream);
  310. }
  311.         
  312. inline FW_CWritableStream& operator<<(FW_CWritableStream& stream, const FW_CString& string)
  313. {
  314.     return string.PrivWrite(stream);
  315. }
  316.  
  317. //========================================================================================
  318. //    CLASS FW_CAcquireNulTerminatedString
  319. //========================================================================================
  320.  
  321. class FW_CAcquireNulTerminatedString
  322. {
  323. public:
  324.     FW_DECLARE_AUTO(FW_CAcquireNulTerminatedString)
  325.     
  326.     FW_CAcquireNulTerminatedString(const FW_CString& string);
  327.     ~FW_CAcquireNulTerminatedString();
  328.     operator const char*() const
  329.         { return fExportedString; }
  330.     
  331. private:
  332.     char* fExportedString;
  333. };
  334.  
  335. //========================================================================================
  336. //    CLASS FW_CAcquireNulTerminatedString255
  337. //========================================================================================
  338.  
  339. class FW_CAcquireNulTerminatedString255
  340. {
  341. public:
  342.     FW_CAcquireNulTerminatedString255(const FW_CString& string);
  343.     // no destructor necessary
  344.     operator const char*() const
  345.         { return fExportedString; }
  346.     
  347. private:
  348.     char fExportedString[255];
  349. };
  350.  
  351. //========================================================================================
  352. //    FW_CString inline functions
  353. //========================================================================================
  354.  
  355. //----------------------------------------------------------------------------------------
  356. //    FW_CString::GetByteLength
  357. //----------------------------------------------------------------------------------------
  358.  
  359. inline FW_ByteCount FW_CString::GetByteLength() const
  360. {
  361.     return FW_PrivString_GetByteLength(fRep);
  362. }
  363.  
  364. //----------------------------------------------------------------------------------------
  365. //    FW_CString::GetCapacity
  366. //----------------------------------------------------------------------------------------
  367.  
  368. inline FW_ByteCount FW_CString::GetCapacity() const
  369. {
  370.     return FW_PrivString_GetCapacity(fRep);
  371. }
  372.  
  373. //----------------------------------------------------------------------------------------
  374. //    FW_CString::IsEmpty
  375. //----------------------------------------------------------------------------------------
  376.  
  377. inline FW_Boolean FW_CString::IsEmpty() const
  378. {
  379.     return GetByteLength() == 0;
  380. }
  381.     
  382. //----------------------------------------------------------------------------------------
  383. //    FW_CString::GetLocale
  384. //----------------------------------------------------------------------------------------
  385.  
  386. inline void FW_CString::GetLocale(FW_Locale& locale) const
  387. {
  388.     FW_PrivString_GetLocale(fRep, &locale);
  389. }
  390.  
  391. //----------------------------------------------------------------------------------------
  392. //    FW_CString::RevealBuffer
  393. //----------------------------------------------------------------------------------------
  394.  
  395. inline const char* FW_CString::RevealBuffer() const
  396. {
  397.     return FW_PrivString_RevealBuffer(fRep);
  398. }
  399.  
  400. //----------------------------------------------------------------------------------------
  401. //    FW_CString::RevealODIText
  402. //----------------------------------------------------------------------------------------
  403.  
  404. inline ODIText* FW_CString::RevealODIText() const
  405. {
  406.     return FW_PrivString_RevealODIText(fRep);
  407. }
  408.  
  409. //----------------------------------------------------------------------------------------
  410. //    FW_CString::Retrieve
  411. //----------------------------------------------------------------------------------------
  412.  
  413. inline void FW_CString::Retrieve(char* destination, 
  414.               FW_ByteCount numberBytes, 
  415.               FW_BytePosition position) const
  416. {
  417.     FW_PrivString_Retrieve(fRep, destination, numberBytes, position);
  418. }
  419.  
  420. //----------------------------------------------------------------------------------------
  421. //    FW_CString::Delete
  422. //----------------------------------------------------------------------------------------
  423.  
  424. inline void FW_CString::Delete(FW_ByteCount numberBytes, 
  425.             FW_BytePosition position)
  426. {
  427.     FW_PlatformError error = 0;
  428.     fRep = FW_PrivString_Delete(fRep, numberBytes, position, &error);
  429.     FW_FailOnError(error);
  430. }
  431.  
  432. //----------------------------------------------------------------------------------------
  433. //    FW_CString::Truncate
  434. //----------------------------------------------------------------------------------------
  435.  
  436. inline void FW_CString::Truncate(FW_BytePosition position)
  437. {
  438.     FW_PlatformError error = 0;
  439.     fRep = FW_PrivString_Truncate(fRep, position, &error);
  440.     FW_FailOnError(error);
  441. }
  442.  
  443. //----------------------------------------------------------------------------------------
  444. //    FW_CString::Insert
  445. //----------------------------------------------------------------------------------------
  446.  
  447. inline void FW_CString::Insert(const char* bytes, 
  448.             FW_ByteCount numberBytes,  
  449.             FW_BytePosition position)
  450. {
  451.     FW_PlatformError error = 0;
  452.     fRep = FW_PrivString_InsertBytes(fRep, bytes, numberBytes, position, &error);
  453.     FW_FailOnError(error);
  454. }
  455.  
  456. //----------------------------------------------------------------------------------------
  457. //    FW_CString::Insert
  458. //----------------------------------------------------------------------------------------
  459.  
  460. inline void FW_CString::Insert(ODIText* text, FW_BytePosition position)
  461. {
  462.     FW_PlatformError error = 0;
  463.     fRep = FW_PrivString_InsertODIText(fRep, text, position, &error);
  464.     FW_FailOnError(error);
  465. }
  466.     
  467. //----------------------------------------------------------------------------------------
  468. //    FW_CString::Insert
  469. //----------------------------------------------------------------------------------------
  470.  
  471. inline void FW_CString::Insert(const FW_CString &string, FW_BytePosition position)
  472. {
  473.     FW_PlatformError error = 0;
  474.     fRep = FW_PrivString_InsertStringRep(fRep, string.fRep, position, &error);
  475.     FW_FailOnError(error);
  476. }
  477.  
  478. //----------------------------------------------------------------------------------------
  479. //    FW_CString::ReplaceAll
  480. //----------------------------------------------------------------------------------------
  481.  
  482. inline void FW_CString::ReplaceAll(ODIText* text)
  483. {
  484.     FW_PlatformError error = 0;
  485.     fRep = FW_PrivString_ReplaceAllODIText(fRep, text, &error);
  486.     FW_FailOnError(error);
  487. }
  488.  
  489. //----------------------------------------------------------------------------------------
  490. //    FW_CString::ReplaceAll
  491. //----------------------------------------------------------------------------------------
  492.  
  493. inline void FW_CString::ReplaceAll(const FW_CString &string)
  494. {
  495.     FW_PlatformError error = 0;
  496.     fRep = FW_PrivString_ReplaceAllStringRep(fRep, string.fRep, &error);
  497.     FW_FailOnError(error);
  498. }
  499.  
  500. //----------------------------------------------------------------------------------------
  501. //    FW_CString::ReplaceAll
  502. //----------------------------------------------------------------------------------------
  503.  
  504. inline void FW_CString::ReplaceAll(const char* bytes, FW_ByteCount numberBytes)
  505. {
  506.     FW_PlatformError error = 0;
  507.     fRep = FW_PrivString_ReplaceAllBytes(fRep, bytes, numberBytes, &error);
  508.     FW_FailOnError(error);
  509. }
  510.  
  511. //----------------------------------------------------------------------------------------
  512. //    FW_CString::ReplaceAll
  513. //----------------------------------------------------------------------------------------
  514.  
  515. inline void FW_CString::ReplaceAll(const char* string)
  516. {
  517.     FW_PlatformError error = 0;
  518.     fRep = FW_PrivString_ReplaceAllBytes(fRep, string, FW_PrimitiveStringLength(string), &error);
  519.     FW_FailOnError(error);
  520. }
  521.  
  522. //----------------------------------------------------------------------------------------
  523. //    FW_CString::ReplaceAll
  524. //----------------------------------------------------------------------------------------
  525.  
  526. inline void FW_CString::ReplaceAll(const FW_PascalChar* string)
  527. {
  528.     FW_PlatformError error = 0;
  529.     fRep = FW_PrivString_ReplaceAllBytes(fRep, (const char*) (string+1), *string, &error);
  530.     FW_FailOnError(error);
  531. }
  532.  
  533. //----------------------------------------------------------------------------------------
  534. //    FW_CString::Append
  535. //----------------------------------------------------------------------------------------
  536.  
  537. inline void FW_CString::Append(ODIText* text)
  538. {
  539.     FW_PlatformError error = 0;
  540.     fRep = FW_PrivString_AppendODIText(fRep, text, &error);
  541.     FW_FailOnError(error);
  542. }
  543.     
  544. //----------------------------------------------------------------------------------------
  545. //    FW_CString::Append
  546. //----------------------------------------------------------------------------------------
  547.  
  548. inline void FW_CString::Append(const FW_CString &string)
  549. {
  550.     FW_PlatformError error = 0;
  551.     fRep = FW_PrivString_AppendStringRep(fRep, string.fRep, &error);
  552.     FW_FailOnError(error);
  553. }
  554.  
  555. //----------------------------------------------------------------------------------------
  556. //    FW_CString::Append
  557. //----------------------------------------------------------------------------------------
  558.  
  559. inline void FW_CString::Append(const char* bytes, FW_ByteCount numberBytes)
  560. {
  561.     FW_PlatformError error = 0;
  562.     fRep = FW_PrivString_AppendBytes(fRep, bytes, numberBytes, &error);
  563.     FW_FailOnError(error);
  564. }
  565.  
  566. //----------------------------------------------------------------------------------------
  567. //    FW_CString::Append
  568. //----------------------------------------------------------------------------------------
  569.  
  570. inline void FW_CString::Append(const char* string)
  571. {
  572.     FW_PlatformError error = 0;
  573.     fRep = FW_PrivString_AppendBytes(fRep, string, FW_PrimitiveStringLength(string), &error);
  574.     FW_FailOnError(error);
  575. }
  576.  
  577. //----------------------------------------------------------------------------------------
  578. //    FW_CString::Append
  579. //----------------------------------------------------------------------------------------
  580.  
  581. inline void FW_CString::Append(char character)
  582. {
  583.     FW_PlatformError error = 0;
  584.     fRep = FW_PrivString_AppendBytes(fRep, &character, 1, &error);
  585.     FW_FailOnError(error);
  586. }
  587.  
  588. //----------------------------------------------------------------------------------------
  589. //    FW_CString::Prepend
  590. //----------------------------------------------------------------------------------------
  591.  
  592. inline void FW_CString::Prepend(const FW_CString &string)
  593. {
  594.     FW_PlatformError error = 0;
  595.     fRep = FW_PrivString_PrependStringRep(fRep, string.fRep, &error);
  596.     FW_FailOnError(error);
  597. }
  598.  
  599. //----------------------------------------------------------------------------------------
  600. //    FW_CString::Prepend
  601. //----------------------------------------------------------------------------------------
  602.  
  603. inline void FW_CString::Prepend(ODIText* text)
  604. {
  605.     FW_PlatformError error = 0;
  606.     fRep = FW_PrivString_PrependODIText(fRep, text, &error);
  607.     FW_FailOnError(error);
  608. }
  609.  
  610. //----------------------------------------------------------------------------------------
  611. //    FW_CString::Prepend
  612. //----------------------------------------------------------------------------------------
  613.  
  614. inline void FW_CString::Prepend(const char* bytes, FW_ByteCount numberBytes)
  615. {
  616.     FW_PlatformError error = 0;
  617.     fRep = FW_PrivString_PrependBytes(fRep, bytes, numberBytes, &error);
  618.     FW_FailOnError(error);
  619. }
  620.  
  621. //----------------------------------------------------------------------------------------
  622. //    FW_CString::Prepend
  623. //----------------------------------------------------------------------------------------
  624.  
  625. inline void FW_CString::Prepend(const char* string)
  626. {
  627.     FW_PlatformError error = 0;
  628.     fRep = FW_PrivString_PrependBytes(fRep, string, FW_PrimitiveStringLength(string), &error);
  629.     FW_FailOnError(error);
  630. }
  631.  
  632. //----------------------------------------------------------------------------------------
  633. //    FW_CString::operator+=
  634. //----------------------------------------------------------------------------------------
  635.  
  636. inline void  FW_CString::operator+=(const FW_CString &string)
  637. {
  638.     FW_PlatformError error = 0;
  639.     fRep = FW_PrivString_AppendStringRep(fRep, string.fRep, &error);
  640.     FW_FailOnError(error);
  641. }
  642.  
  643. //----------------------------------------------------------------------------------------
  644. //    FW_CString::operator+=
  645. //----------------------------------------------------------------------------------------
  646.  
  647. inline void  FW_CString::operator+=(ODIText* text)
  648. {
  649.     FW_PlatformError error = 0;
  650.     fRep = FW_PrivString_AppendODIText(fRep, text, &error);
  651.     FW_FailOnError(error);
  652. }
  653.  
  654. //----------------------------------------------------------------------------------------
  655. //    FW_CString::operator+=
  656. //----------------------------------------------------------------------------------------
  657.  
  658. inline void  FW_CString::operator+=(const char* string)
  659. {
  660.     FW_PlatformError error = 0;
  661.     fRep = FW_PrivString_AppendBytes(fRep, string, FW_PrimitiveStringLength(string), &error);
  662.     FW_FailOnError(error);
  663. }
  664.  
  665. //----------------------------------------------------------------------------------------
  666. //    FW_CString::operator+=
  667. //----------------------------------------------------------------------------------------
  668.  
  669. inline void  FW_CString::operator+=(char character)
  670. {
  671.     FW_PlatformError error = 0;
  672.     fRep = FW_PrivString_AppendBytes(fRep, &character, 1, &error);
  673.     FW_FailOnError(error);
  674. }
  675.  
  676. //----------------------------------------------------------------------------------------
  677. //    FW_CString::ExportCString
  678. //----------------------------------------------------------------------------------------
  679.  
  680. inline void FW_CString::ExportCString(char* buffer) const
  681. {
  682.     FW_PrivString_ExportCString(fRep, buffer);
  683. }
  684.  
  685. //----------------------------------------------------------------------------------------
  686. //    FW_CString::ExportPascal
  687. //----------------------------------------------------------------------------------------
  688.  
  689. inline void FW_CString::ExportPascal(FW_PascalChar* buffer) const
  690. {
  691.     FW_PrivString_ExportPascalString(fRep, buffer);
  692. }
  693.  
  694. //----------------------------------------------------------------------------------------
  695. //    FW_CString::ToUpper
  696. //----------------------------------------------------------------------------------------
  697.  
  698. inline void FW_CString::ToUpper()
  699. {
  700.     FW_PlatformError error = 0;
  701.     fRep =     FW_PrivString_ToUpper(fRep, &error);
  702.     FW_FailOnError(error);
  703. }
  704.  
  705. //----------------------------------------------------------------------------------------
  706. //    FW_CString::ToLower
  707. //----------------------------------------------------------------------------------------
  708.  
  709. inline void FW_CString::ToLower()
  710. {
  711.     FW_PlatformError error = 0;
  712.     fRep =     FW_PrivString_ToLower(fRep, &error);
  713.     FW_FailOnError(error);
  714. }
  715.  
  716. //----------------------------------------------------------------------------------------
  717. //    FW_CString::Substitute
  718. //----------------------------------------------------------------------------------------
  719.  
  720. inline FW_Boolean FW_CString::Substitute(const FW_CString &searchString,
  721.                                   const FW_CString &substitutionString)
  722. {
  723.     FW_PlatformError error = 0;
  724.     FW_Boolean wasReplaced;
  725.     fRep =     FW_PrivString_Substitute(fRep, searchString.fRep, substitutionString.fRep, &wasReplaced, &error);
  726.     FW_FailOnError(error);
  727.     return wasReplaced;
  728. }
  729.  
  730. //----------------------------------------------------------------------------------------
  731. //    FW_CString::FindSubString
  732. //----------------------------------------------------------------------------------------
  733.  
  734. inline FW_Boolean FW_CString::FindSubString(const FW_CString &subString,
  735.                                       FW_BytePosition &foundPosition,
  736.                                      FW_BytePosition startPosition) const
  737. {
  738.     return FW_PrivString_FindSubString(fRep, subString.fRep, &foundPosition, startPosition);
  739. }
  740.  
  741. //----------------------------------------------------------------------------------------
  742. //    FW_CString::FindCharacter
  743. //----------------------------------------------------------------------------------------
  744.  
  745. inline FW_Boolean FW_CString::FindCharacter(FW_LChar character,
  746.                                      FW_BytePosition &foundPosition,
  747.                                      FW_BytePosition startPosition,
  748.                                      FW_FindDirection direction) const
  749. {
  750.     return FW_PrivString_FindCharacter(fRep, character, &foundPosition, startPosition, direction);
  751. }
  752.  
  753. //----------------------------------------------------------------------------------------
  754. //    FW_CString::operator=
  755. //----------------------------------------------------------------------------------------
  756.  
  757. inline void FW_CString::operator=(const FW_CString &other)
  758. {
  759.     ReplaceAll(other);
  760. }
  761.  
  762. //----------------------------------------------------------------------------------------
  763. //    FW_CString::operator=
  764. //----------------------------------------------------------------------------------------
  765.  
  766. inline void  FW_CString::operator=(ODIText *text)
  767. {
  768.     ReplaceAll(text);
  769. }
  770.  
  771. //----------------------------------------------------------------------------------------
  772. //    FW_CString::operator=
  773. //----------------------------------------------------------------------------------------
  774.  
  775. inline void  FW_CString::operator=(const char* text)
  776. {
  777.     ReplaceAll(text);
  778. }
  779.  
  780. #endif
  781.